package leetcode.code1524;

public class Solution {

	int mod = (int) 1e9 + 7;

	public int numOfSubarrays(int[] arr) {
		int o = 0, e = 0;
		long ans = 0;
		for (int i = 0; i < arr.length; i++) {
			int ce = 0 , co = 0;
			if ((arr[i] & 1) == 1) {
				ce = o;
				co = e + 1;
			} else {
				ce = e + 1;
				co = o;
			}
			o = co;
			e = ce;
			ans += o;
			ans %= mod;
		}
		return (int) ans;
	}
}
